package com.example.oasystem.service.impl;

import com.example.oasystem.dao.process.AoaUserProcessDaoOfSun;
import com.example.oasystem.entity.dept.AoaDept;
import com.example.oasystem.entity.position.AoaPosition;
import com.example.oasystem.entity.process.AoaProcessOfSun;
import com.example.oasystem.entity.process.AoaUserProcessOfSun;
import com.example.oasystem.service.AoaUserProcessServiceOfSun;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AoaUserProcessServiceImplOfSun implements AoaUserProcessServiceOfSun {

    @Autowired
    private AoaUserProcessDaoOfSun aoaUserProcessDaoOfSun;


    @Override
    public List<AoaPosition> selectPosition() {
        return aoaUserProcessDaoOfSun.selectPosition();
    }

    @Override
    public List<AoaDept> selectDept() {
        return aoaUserProcessDaoOfSun.selectDept();
    }

    @Override
    public PageInfo<AoaUserProcessOfSun> selectUsers(int pageNum, int pageSize, String baseKey,long fatherId) {
        PageHelper.startPage(pageNum,pageSize);
        List<AoaUserProcessOfSun> aoaProcessOfSuns = aoaUserProcessDaoOfSun.selectUsers(baseKey,fatherId);
        PageInfo<AoaUserProcessOfSun> pageInfo = new PageInfo<>(aoaProcessOfSuns);
        return pageInfo;
    }

    @Override
    public List<AoaUserProcessOfSun> selectUserProcess(long id,String... userName) {
        return aoaUserProcessDaoOfSun.selectUserProcess(id,userName);
    }

    @Override
    public long selectOneUser(String userName) {
        return aoaUserProcessDaoOfSun.selectOneUser(userName);
    }

    @Override
    public PageInfo<AoaUserProcessOfSun> selectUserSubordinate(int pageNum, int pageSize, long userId, String baseKey) {
        PageHelper.startPage(pageNum,pageSize);
        List<AoaUserProcessOfSun> aoaUserProcessDaoOfSuns = aoaUserProcessDaoOfSun.selectUserSubordinate(userId, baseKey);
        PageInfo<AoaUserProcessOfSun> pageInfo = new PageInfo<>(aoaUserProcessDaoOfSuns);
        return pageInfo;
    }


}
